Jx.declare('Jx.data.Field', {

	$extend: 'Jx.lib.Configurable',

	$requires: [

		'Jx.data.Index',

		'Jx.lib.Unit'

	],

	$actions: [

		''

	],

	$accessors: {

		name: '',

		type: 'scalar',

		index: '',

		getterMethod: 'getValue',

		getterParams: undefined

	},

	initializeValue: function(record){

		var name = this.name(),

			unit = 'unit.'+this.type();

		record.set(

			name,

			Jx.instantiate(unit, [record.get(name)])

		);


	},

	onSetType: function(operation){

		this.set('type', operation.type);

	},

	allowSetType: function(operation, type){

		return Jx.isString(operation.type = type, true) &&

			Jx.isClass('Jx.lib.Unit', 'unit.'+type);

	}





});
